import java.util.*;
public class Main2{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str1 = scan.next();
        String str2 =scan.next();
        // 因为输入为 字符串，所以要 先从字符串里提取出 分子 和 分母
        long numerator1 = Integer.parseInt(str1.substring(0,str1.indexOf('/')));
        long denominator1 =Integer.parseInt(str1.substring(str1.indexOf('/')+1));
        long numerator2 = Integer.parseInt(str2.substring(0,str2.indexOf('/')));
        long denominator2 =Integer.parseInt(str2.substring(str2.indexOf('/')+1));
        // 把第一个数 处理为合规的数，然后直接输出
        String num1 = resultSort(numerator1,denominator1);
        // 把第二个数 处理为合规的数，然后直接输出
        String num2 = resultSort(numerator2,denominator2);
        String sumResult = sum(numerator1,denominator1,numerator2,denominator2);
        String differenceResult = difference(numerator1,denominator1,numerator2,denominator2);
        String productResult = product(numerator1,denominator1,numerator2,denominator2);
        String quotientResult =quotient(numerator1,denominator1,numerator2,denominator2);
        System.out.println(num1+" "+ "+"+" "+ num2+" "+"=" +" "+sumResult);
        System.out.println(num1+" "+ "-"+" "+ num2+" "+"=" +" "+differenceResult);
        System.out.println(num1+" "+ "*"+" "+ num2+" "+"=" +" "+productResult);
        System.out.println(num1+" "+ "/"+" "+ num2+" "+"=" +" "+quotientResult);


    }
    // 这个就是处理 结果的函数
    public static String resultSort(long numerator1,long denominator1){
        String result ="";
        result += "(";
        // 这里 处理整数
        if(numerator1 % denominator1 == 0){
            result += numerator1 / denominator1;
            // 这里处理分数
        }else{
            // 算最大公约数
            long divisor = divisor(numerator1,denominator1);
            numerator1 /= divisor;
            denominator1 /= divisor;
            // 处理假分数
            if(numerator1 / denominator1 != 0){
                result += (numerator1 / denominator1)+" "+(Math.abs((numerator1 %
                 